import { BadRequestException, PipeTransform } from "@nestjs/common";
export class ParseEnumPipe implements PipeTransform<string> {
  constructor(private enumType: any) {}
  transform(value: string) {
    const enumValues = Object.values(this.enumType);
    if (!enumValues.includes(value)) {
      throw new BadRequestException(`${value} is not a valid value`);
    }
    return value;
  }
}
